//
//  Student.m
//  OC02_实例变量可见度_方法
//
//  Created by 侯平章 on 16/2/21.
//  Copyright © 2016年 侯平章. All rights reserved.
//

#import "Student.h"

@implementation Student

#pragma mark - 重写init
- (instancetype)init{
    self = [super init];
    if (self) {
        _classRoomName = @"DLS160101";
    }
    return self;
}

#pragma mark - 重写父类方法

/**
 *重写父类方法时,父类方法不用在.h文件中声明,直接在.m文件中实现即可.
 *
 */
- (void)sayHi{
    /** super 是编译器指令,指调用父类方法
     * [super sayHi] 是当前对象调用父类的方法,而不是父类对象调用sayHi方法.
     */
    [super sayHi];
    NSLog(@"grade:%f,classRoomName:%@",_grade,_classRoomName);
}

- (void)setGrade:(float)grade{
    _grade = grade;
}
- (float)grade{
    return _grade;
}
- (void)setClassRoomName:(NSString*)classRoomName{
    _classRoomName = classRoomName;
}
- (NSString*)classRoomName{
    return _classRoomName;
}

@end
